<!--
  This file is a part of the open-eBackup project.
  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
  If a copy of the MPL was not distributed with this file, You can obtain one at
  http://mozilla.org/MPL/2.0/.
  
  Copyright (c) [2024] Huawei Technologies Co.,Ltd.
  
  THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
  EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
  MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  -->

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en-us" xml:lang="en-us">
 <head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="DC.Type" content="topic">
  <meta name="DC.Title" content="Managing Snapshots">
  <meta name="DC.Format" content="XHTML">
  <meta name="DC.Identifier" content="EN-US_TOPIC_0000002024918278">
  <meta name="DC.Language" content="en-us">
  <link rel="stylesheet" type="text/css" href="public_sys-resources/commonltr.css">
  <title>Managing Snapshots</title>
 </head>
 <body style="clear:both; padding-left:10px; padding-top:5px; padding-right:5px; padding-bottom:5px">
  <a name="EN-US_TOPIC_0000002024918278"></a><a name="EN-US_TOPIC_0000002024918278"></a>
  <h1 class="topictitle1">Managing Snapshots</h1>
  <div>
   <div class="section">
    <h4 class="sectiontitle">Symptom</h4>
    <p>Failed to enable the snapshot function.</p>
   </div>
   <div class="section">
    <h4 class="sectiontitle">Possible Cause</h4>
    <p>The directory for which the snapshot function is to be enabled may contain subdirectories with the snapshot function enabled.</p>
   </div>
   <div class="section">
    <h4 class="sectiontitle">Procedure</h4>
    <ol>
     <li><span>Before enabling the snapshot function, log in to the HDFS agent host as user <strong>root</strong> using PuTTY.</span></li>
     <li><span>Run the following command to execute the environment variable:</span><p></p><pre class="screen">source <em>Installation directory</em>/bigdata_env</pre> <p></p></li>
     <li><span>Run the following command to switch to the HDFS database user:</span><p></p><pre class="screen">kinit <em>HDFS database user</em></pre>
      <div class="fignone">
       <span class="figcap"><b>Figure 1 </b>Login as the HDFS database user</span><br><span><img src="en-us_image_0000002062302697.png"></span>
      </div> <p></p></li>
     <li><span>Run the following commands to manage snapshots.</span><p></p>
      <ul>
       <li>Query all snapshots in a directory:<pre class="screen">hdfsdfs -ls <em>Directory</em>.snapshot</pre>
        <div class="fignone">
         <span class="figcap"><b>Figure 2 </b>Querying all snapshots in the root directory (<strong>/</strong>)</span><br><span><img src="en-us_image_0000002062230577.png"></span>
        </div></li>
      </ul>
      <ul>
       <li>Delete snapshots from a directory:<pre class="screen">hdf sdfs -deleteSnapshot <em>Directory</em> <em>Snapshot name</em></pre>
        <div class="fignone">
         <span class="figcap"><b>Figure 3 </b>Deleting snapshots in the root directory (<strong>/</strong>)</span><br><span><img src="en-us_image_0000002062092889.png"></span>
        </div></li>
      </ul>
      <ul>
       <li>Query the directories for which the snapshot function is enabled and the permissions on the directories:<pre class="screen">hdfs lsSnapshottableDir</pre>
        <div class="fignone">
         <span class="figcap"><b>Figure 4 </b>Querying the directories for which the snapshot function is enabled and the permissions on the directories</span><br><span><img src="en-us_image_0000002062264957.png"></span>
        </div></li>
      </ul>
      <ul>
       <li>Disable the snapshot function for a directory:<pre class="screen">hdfs dfsadmin -disallowSnapshot <em>Directory</em></pre>
        <div class="fignone">
         <span class="figcap"><b>Figure 5 </b>Disabling the snapshot function of the root directory (<strong>/</strong>)</span><br><span><img src="en-us_image_0000002062289265.png"></span>
        </div>
        <div class="note">
         <img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span>
         <div class="notebody">
          <p>Before disabling the snapshot function for a directory, you must delete all snapshots in the directory.</p>
         </div>
        </div></li>
      </ul> <p></p></li>
    </ol>
   </div>
  </div>
 </body>
</html>